//
//  KLShopHeaderView.m
//  KunLun
//
//  Created by Mac on 2017/12/14.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLShopHeaderView.h"
#import "STXingXIngView.h"
@interface  KLShopHeaderView()
@property(nonatomic, strong) UIImageView                 *iconImageView;
@property(nonatomic, strong) STXingXIngView              *xingxingView;
@property(nonatomic, strong) STLabel                     *nameLable;//商品名字
@property(nonatomic, strong) STLabel                     *uploadLable;//是否缴纳保证金
@property(nonatomic, strong) STLabel                     *idLable;//商品名字
@property(nonatomic, strong) STLabel                     *goodDetailLable;//商品描述
@end
@implementation KLShopHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    __weak typeof(self) weakSelf =  self;
    self.backgroundColor = [UIColor whiteColor];
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10,  10, 80, 80)];
    self.iconImageView.image = [UIImage imageNamed:@"06"];
    [self addSubview:self.iconImageView];
    
    self.uploadLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 35 + 0, 80, 14)
                                                 text:@"已缴纳保证金"
                                            textColor:KL_secendTextColor
                                                 font:12
                                          isSizetoFit:NO
                                        textAlignment:NSTextAlignmentRight];
    self.uploadLable.right = UIScreenWidth - 10;
    [self addSubview:self.uploadLable];
    UIImageView * shopImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    shopImageView.image = [UIImage imageNamed:@"icon_诚信"];
    shopImageView.centerX = self.uploadLable.centerX;
    shopImageView.bottom = self.uploadLable.top;
    [self addSubview:shopImageView];
    
    STButton * contactButton = [[STButton alloc] initWithFrame:CGRectMake(0, self.uploadLable.bottom + 15, 70, 30)
                                                         title:@"联系商家"
                                                    titleColor:[UIColor whiteColor]
                                                     titleFont:14
                                                  cornerRadius:5
                                               backgroundColor:KL_BlueBackGroundColor
                                               backgroundImage:nil
                                                         image:nil];
    contactButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    contactButton.right = self.uploadLable.right;
    [contactButton setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedContactButton];
    }];
    [self addSubview:contactButton];
    
    STLabel * nameLable = [[STLabel alloc] initWithFrame:CGRectMake(10 + _iconImageView.right, _iconImageView.top + 3, self.uploadLable.left - 20 - self.iconImageView.right, 15)
                                                    text:@"猕猴桃"
                                               textColor:KL_firstTextColor
                                                    font:15
                                             isSizetoFit:NO
                                           textAlignment:NSTextAlignmentLeft];
    self.nameLable = nameLable;
    [self addSubview:nameLable];
    
    self.xingxingView = [[STXingXIngView alloc] initWithFrame:CGRectMake(self.iconImageView.right  +10, self.nameLable.bottom + 5, self.uploadLable.left - 20 - self.iconImageView.right, 30) maxsNum:5];
    [self.xingxingView makeXingXingSelectedWithNum:2];
    [self addSubview:self.xingxingView];
    
    self.idLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right  +10, self.xingxingView.bottom, self.uploadLable.left - 20 - self.iconImageView.right, 40)
                                             text:@"匀加速ID"
                                        textColor:KL_secendTextColor
                                             font:13
                                      isSizetoFit:NO
                                    textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.idLable];
    
    self.goodDetailLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.iconImageView.bottom + 20, UIScreenWidth - 20, 40)
                                                     text:@"米好头等哈就是看会多久啊开始登记卡上登记卡上的安徽快点撒即可很多贾克斯ad哈贾克斯的黄金卡上登记卡上的卡萨骄傲的快速的黄金卡上的健康安徽登记卡还是登记卡上的熬枯受淡哈贾克斯的黄金卡上登记卡上的杰卡斯as快点哈烧烤活动"
                                                textColor:UIColorFromRGBA(0x686868)
                                                     font:13
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    self.goodDetailLable.height = [self.goodDetailLable.text st_heigthWithwidth:UIScreenWidth - 20 font:13] + 10;
    [self addSubview:self.goodDetailLable];
   
    self.height = self.goodDetailLable.bottom;
}
#pragma mark --Action Method
- (void)onSelectedContactButton{
    
}
@end
